package com.example.smartcity_ikun3.ui.home.activity.more

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.MenuItem
import android.widget.Button
import android.widget.EditText
import android.widget.RadioGroup
import com.example.smartcity_ikun3.R

class PhoneActivity : AppCompatActivity() {

    private lateinit var mPhonePhone: EditText
    private lateinit var mRadio: RadioGroup
    private lateinit var mPhoneOk: Button

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
        setContentView(R.layout.activity_phone)
        title = "话费充值"

        setView()
        setEvent()

    }


    // 获取控件
    private fun setView() {
        mPhonePhone = findViewById(R.id.PhonePhone)
        mRadio = findViewById(R.id.PhoneRadio)
        mPhoneOk = findViewById(R.id.PhoneOk)
    }



    // 点击事件
    private fun setEvent() {
        mPhoneOk.setOnClickListener {
            startActivity(Intent(this, TopUpPhoneActivity::class.java).apply {

                putExtra("phone", mPhonePhone.text.toString())
            })
        }
    }

    override fun onOptionsItemSelected(item: MenuItem): Boolean {
        finish()
        return super.onOptionsItemSelected(item)
    }
}